import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const routes = [
  {
    path: "/",
    name: "Admin",
    meta: {
      title: "首页",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Admin" */ "./views/admin/Admin.vue"),
  },
  {
    path: "/Wisdom_office",
    name: "Zhbg",
    meta: {
      title: "智慧办公",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Zhbg" */ "./views/zhjs/Zhbg.vue"),
  },
  {
    path: "/Wisdom_Toolbox",
    name: "Tygjx",
    meta: {
      title: "通用工具箱",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Tygjx" */ "./views/zhjs/Tygjx.vue"),
  },
  {
    path: "/Wisdom_hotel",
    name: "Zhjd",
    meta: {
      title: "智慧酒店",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Zhjd" */ "./views/zhjs/zhjd/Zhjd.vue"),
  },
  {
    path: "/One_stop_service",
    name: "Yzsfw",
    meta: {
      title: "一站式服务",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Yzsfw" */ "./views/zhjs/zhjd/Yzsfw.vue"),
  },
  {
    path: "/Operation_can_assign",
    name: "Yyfn",
    meta: {
      title: "运营赋能",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Yyfn" */ "./views/yyfn/Yyfn.vue"),
  },
  {
    path: "/The_visual_design",
    name: "Sjsj",
    meta: {
      title: "视觉设计",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Sjsj" */ "./views/yyfn/Sjsj.vue"),
  },
  {
    path: "/The_data_analysis",
    name: "Sjfx",
    meta: {
      title: "数据分析",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Sjfx" */ "./views/zhjs/zhjd/Sjfx.vue"),
  },
  {
    path: "/Traffic_guidance",
    name: "Jtzn",
    meta: {
      title: "交通指南",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Jtzn" */ "./views/zhjs/Jtzn.vue"),
  },
  {
    path: "/Autogeneration_of_Travel_Notes",
    name: "Yjzdsc",
    meta: {
      title: "游记自动生成",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Yjzdsc" */ "./views/zhjs/Yjzdsc.vue"),
  },
  {
    path: "/Service_induced",
    name: "Fwyd",
    meta: {
      title: "服务诱导",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Fwyd" */ "./views/zhjs/Fwyd.vue"),
  },
  {
    path: "/The_guide_tour",
    name: "Dydl",
    meta: {
      title: "导游导览",
      keepAlive: false,
      tokenId: true,
      keywords:"大运河"||"文旅"||"企业服务平台",
      description:"一个旅游项目"
    },
    component: () =>
      import(/* webpackChunkName: "Dydl" */ "./views/zhjs/Dydl.vue"),
  },
  { path: "/404", component: () => import("./views/admin/Admin.vue") },
  // 404 page must be placed at the end !!!
  { path: "*", redirect: "/404" },

  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "./views/About.vue"),
  },
  {
    path: "/museum",
    name: "智慧博物馆",
    meta: {
      title: "智慧博物馆",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/zhjs/Bwg.vue"], resolve),
  },
  {
    path: "/operation",
    name: "文旅项目运营赋能",
    meta: {
      title: "文旅项目运营赋能",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/Whzc/Wlyyfn.vue"], resolve),
  },
  {
    path: "/wisdom",
    name: "知识图谱",
    meta: {
      title: "知识图谱",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/Whzc/Txzstp.vue"], resolve),
  },
  {
    path: "/schleimigen",
    name: "智慧文创",
    meta: {
      title: "智慧文创",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/zhjs/Zhwc.vue"], resolve),
  },
  {
    path: "/service",
    name: "智能客服",
    meta: {
      title: "智能客服",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/zhjs/service.vue"], resolve),
  },
  {
    path: "/traveldistribution",
    name: "旅游产品分销平台",
    meta: {
      title: "旅游产品分销平台",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) =>
      require(["./views/srdemo/touristtrain/touristtrain.vue"], resolve),
  },
  {
    path: "/paid_on_fuiton",
    name: "薪福通",
    meta: {
      title: "薪福通",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) =>
      require(["./views/yyfn/paid_on_fuiton.vue"], resolve),
  },
  {
    path: "/emergency_command",
    name: "应急指挥详情",
    meta: {
      title: "应急指挥详情",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) =>
      require(["./views/zhjs/emergency_command.vue"], resolve),
  },
  {
    path: "/ByteDance",
    name: "字节跳动",
    meta: {
      title: "字节跳动",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/yyfn/ByteDance.vue"], resolve),
  },
  {
    path: "/mini_program",
    name: "电商小程序",
    meta: {
      title: "电商小程序",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/yyfn/mini_program.vue"], resolve),
  },
  {
    path: "/arithmetic",
    name: "物联及算法",
    meta: {
      title: "物联及算法",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) => require(["./views/yyfn/arithmetic.vue"], resolve),
  },
  {
    path: "/virtual_museum",
    name: "虚拟博物馆",
    meta: {
      title: "虚拟博物馆",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) =>
      require(["./views/zhjs/virtual_museum.vue"], resolve),
  },
  {
    path: "/foot_shopping",
    name: "美食购物",
    meta: {
      title: "美食购物",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) =>
      require(["./views/zhjs/foot_shopping.vue"], resolve),
  },
  {
    path: "/museum_details",
    name: "博物馆营销详情",
    meta: {
      title: "博物馆营销详情",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) =>
      require(["./views/zhjs/museun_details.vue"], resolve),
  },
  {
    path: "/live_streaming",
    name: "在线直播",
    meta: {
      title: "在线直播",
      keepAlive: false,
      tokenId: true,
    },
    component: (resolve) =>
      require(["./views/zhjs/live_streaming.vue"], resolve),
  },
  {
    path: "/trapoer",
    name: "trapoer",
    component: () => import("@/views/srdemo/trapoer/trapoer.vue"),
  },
  {
    path: "/power_sum",
    name: "power_sum",
    component: () => import("@/views/srdemo/powersum/powersum.vue"),
  },
  {
    path: "/film_xun",
    name: "film_xun",
    component: () => import("@/views/srdemo/filmxun/filmxun.vue"),
  },
  {
    path: "/e_mall",
    name: "e_mall",
    component: () => import("@/views/srdemo/emall/emall.vue"),
  },
  {
    path: "/play_page",
    name: "playpage",
    component: () => import("@/views/srdemo/playpage/playpage.vue"),
  },
  {
    path: "/linkage",
    name: "linkage",
    component: () => import("@/views/srdemo/znldd/linkage.vue"),
  },
  {
    path: "/brand_mark",
    name: "brand_mark",
    component: () => import("@/views/srdemo/brandmark/brandmark.vue"),
  },
  {
    path: "/vr_films",
    name: "vr_films",
    component: () => import("@/views/srdemo/vrfilms/vrfilms.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
  scrollBehavior(to, from, savedPosition) {
    // return 期望滚动到哪个的位置
    if (savedPosition) {
      return savedPosition;
    } else {
      return { x: 0, y: 0 };
    }
  },
});

export default router;
